Project url change after repository rename

Rokas Kupstys's Avatar

Rokas Kupstys

15 May, 2019 01:24 PM

Hello,
At some point i renamed my repository https://github.com/rokups/Urho3D to https://github.com/rokups/rbfx. I also renamed appveyor project, but it is still available under https://ci.appveyor.com/project/rokups/urho3d/ url. Is it possible to make project use https://ci.appveyor.com/project/rokups/rbfx url?

Thanks!

  1. Support Staff 1 Posted by Owen McDonnell on 15 May, 2019 03:47 PM

    Owen McDonnell's Avatar

    Yes, you can use this REST API call.
    Here is a sample script.

    $token = '<your_appveyor_api_token>'
    $headers = @{
      "Authorization" = "Bearer $token"
      "Content-type" = "application/json"
    }
    
    $response = Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/projects/<your_account_name>/<current_project_slug>/settings' -Headers $headers -Method Get
    
    $response.settings.slug="<new_project_slug>"
    
    Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/projects' -Headers $headers -Method PUT -Body ($response.settings | convertto-json -depth 5)
    
  2. 2 Posted by Rokas Kupstys on 17 May, 2019 04:05 PM

    Rokas Kupstys's Avatar

    If i try suggested command it errors out about missing project. My project is already named rbfx, only url contains old slug. Screenshot attached.

  3. Support Staff 3 Posted by Owen McDonnell on 17 May, 2019 05:56 PM

    Owen McDonnell's Avatar

    So your version of the script i offered contains,

    'https://ci.appveyor.com/api/projects/rokups/urho3d/settings' -Headers $headers -Method Get
    

    which gives an error?

  4. 4 Posted by Rokas Kupstys on 18 May, 2019 08:04 AM

    Rokas Kupstys's Avatar

    That is right. I copied token from https://ci.appveyor.com/api-keys and output i get is:

    Invoke-RestMethod : {"message":"Project not found or access denied."}
    At C:\Users\Administrator\Desktop\rename.ps1:11 char:1
    + Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/projects' -Header ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
       eption
        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
    
  5. Support Staff 5 Posted by Owen McDonnell on 18 May, 2019 05:35 PM

    Owen McDonnell's Avatar

    Is it a v1 key (account specific - as in screenshot) or v2 key (all accounts)?

  6. 6 Posted by Rokas Kupstys on 19 May, 2019 07:23 AM

    Rokas Kupstys's Avatar

    I tried both keys which resulted in same error. However i noticed just now that url slug changed and i can now access project through https://ci.appveyor.com/project/rokups/rbfx URL. I assume you fixed it somehow, so thank you very much.

  7. Support Staff 7 Posted by Owen McDonnell on 20 May, 2019 03:47 AM

    Owen McDonnell's Avatar

    Nope... i did nothing.

    Perhaps you made the request twice but didn't realize it the first time, so the second time it failed since there was no longer a matching slug?

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac