How do I provide a meaningful User-Agent string

I understand what qualifies as a meaningful string but how do I provide them?

As a urls? As an XML? To what address?

From the information provided as someone totally new to the platform I haven’t a clue.

https://musicbrainz.org/doc/MusicBrainz_API/Rate_Limiting

I would appreciate help with this, thanks.

https://musicbrainz.org/ws/2/artist/5b11f4ce-a62d-471e-81fc-a69a8278c7da?inc=ratings&fmt=json&User-Agent=nuDevsApp/1.0.0(nuDev@example.com)

I tried this for example and still receive an error code.

The User-Agent is a HTTP header. Whatever HTTP library you are using to access the API should offer you some way to set the header.

4 Likes

Thanks for putting me in the right direction, web facing code really is not my area.

For anyone in the same situation making an android app and using the okhttp3 client this was solved by adding the “.header(“User-Agent”, “nuDev/1.0.0 (nuDev@example.com) )”).build()” to the request builder

fun get(url: String): InputStream {

    val request = Request.Builder().url(url).header("User-Agent", "nuDev/1.0.0 (nuDev@example.com) )").build()
    val response = OkHttpClient().newCall(request).execute()
    val responseBody = response.body()

    return responseBody!!.byteStream()
2 Likes